package com.hsav.kcxb.view;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.widget.ScrollView;

import com.hsav.kcxb.R;

/**
 * Created by gf on 2017/7/2.
 */

public class MusicClipView3 extends ScrollView {
    private static final String TAG = MusicClipView3.class.getName();

    private MusicClipContainer rootContent;

    public MusicClipView3(Context context) {
        super(context);
        createContent();
    }

    public MusicClipView3(Context context, AttributeSet attrs) {
        super(context, attrs);
        createContent();
    }

    public MusicClipContainer getRootContent()
    {
        return rootContent;
    }

    private void createContent() {
        rootContent = new MusicClipContainer(getContext());
        addView(rootContent);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        if (rootContent.isClipping(ev.getRawX(), ev.getRawY()))
        {
            Log.d(TAG, "rootContent.isClipping is true");
            return false;
        }
        return super.onInterceptTouchEvent(ev);
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {

        return super.onTouchEvent(ev);
    }
}
